﻿<UserControl x:Class="Sentinel.FileMonitor.CustomMessageDecoderPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             Loaded="OnLoaded">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <TextBlock Margin="3"
                   Grid.Column="0"
                   Grid.ColumnSpan="2"
                   TextWrapping="WrapWithOverflow">
            <Run>Define a regular expression, using named captures, to decompose the log message into its appropriate fields.</Run>
            <LineBreak />
            <LineBreak />
            <Run>An example pattern would therefore include something like:</Run>
            <LineBreak />
            <LineBreak />
            <Run FontWeight="Bold"
                 FontFamily="Courier New"
                 Text="(?&lt;DateTime&gt;[^|]+)" />
            <LineBreak />
            <LineBreak />
            <Run>Common field names are Description, Type and DateTime and at least one of these must be matched.</Run>
        </TextBlock>
        <TextBlock Grid.Column="0"
                   Grid.Row="1"
                   Margin="3,10,3,3"
                   Text="Pattern : " />
        <TextBox Grid.Column="1"
                 AcceptsReturn="True"
                 Grid.Row="1"
                 Margin="3,10,3,3"
                 Text="{Binding CustomFormat, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, ValidatesOnDataErrors=True}"
                 VerticalAlignment="Stretch" />
        <TextBlock Grid.Column="0"
                   Grid.Row="2"
                   Grid.ColumnSpan="2"
                   TextWrapping="WrapWithOverflow"
                   FontWeight="Bold"
                   Foreground="Red"
                   Text="{Binding Error}"
                   TextAlignment="Center" />
    </Grid>
</UserControl>
